#include "stdafx.h"
#include "HDLWidget.h"
#include <QtXml/qdom.h>
HDLWidget::HDLWidget(QWidget* parent):QWidget(parent)
{
}

HDLWidget::~HDLWidget(void)
{
}
void HDLWidget::InitWidget(){
	QDomDocument doc;
	QFile file(UtAbs("/AppData/DLConfig.xml"));
	if(file.open(QIODevice::ReadOnly)
		&&doc.setContent(&file)){
			QDomElement root=doc.documentElement();
			QDomElement child=root.firstChildElement("dl");
			while(!child.isNull())
			{
				HDLXmlElement item;
				item.SetKey(child.attribute(tr("key")));
				item.SetType(child.attribute(tr("type")));
				item.SetCnName(child.attribute(tr("cn_name")));
				item.SetEnName(child.attribute(tr("en_name")));
				item.SetModel(child.attribute(tr("model")));
				item.SetImage(child.attribute(tr("img")));
				mElementList.append(item);
				child=child.nextSiblingElement();
			}
	} 
}